<template>
    <div id="tcxs">
        <div v-if="show2018" style="width: 45%;float: left;">
            <h2>2018数据</h2>
            <el-table :data="res2018" border show-summary :default-sort="{prop: 'ybrs__sum', order:'descending'}" max-height="500">
                <el-table-column label="套餐名"
                                 prop="tdlx"
                                 width="250"
                ></el-table-column>
                <el-table-column label="人数"
                                 prop="ybrs__sum"
                                 sortable
                ></el-table-column>
                <el-table-column label="购票金额（万元）"
                                 prop="gpje__sum"
                                 sortable
                ></el-table-column>
            </el-table>
        </div>

        <div v-if="show2019" style="width: 45%;float: right;">
            <h2>2019数据</h2>
            <el-table :data="res2019" border show-summary :default-sort="{prop: 'ybrs__sum', order:'descending'}" max-height="500">
                <el-table-column label="套餐名"
                                 prop="tdlx"
                                 width="250"
                ></el-table-column>
                <el-table-column label="人数"
                                 prop="ybrs__sum"
                                 sortable
                ></el-table-column>
                <el-table-column label="购票金额（万元）"
                                 prop="gpje__sum"
                                 sortable
                ></el-table-column>
            </el-table>
        </div>
    </div>

</template>

<script>
    export default {
        name: "rqdyfx",
        data() {
            return {
                show2018: false,
                show2019: false,
                res2018: '',
                res2019: '',
            }
        },
        props: ['midData',],
        computed: {

        },
        mounted() {
            if (this.midData.result2018) {
                this.show2018 = true;
                this.res2018 = this.midData.result2018
                this.res2018.forEach(item=>{
                    item.gpje__sum = parseFloat((item.gpje__sum / 10000).toFixed(3));
                })
            }
            if (this.midData.result2019) {
                this.show2019 = true;
                this.res2019 = this.midData.result2019
                this.res2019.forEach(item=>{
                    item.gpje__sum = parseFloat((item.gpje__sum / 10000).toFixed(3));
                })
            }
        }
    }
</script>

<style scoped>

</style>
